avatar Bite 272. Find common words

Given two sentences that each contains words in case insensitive way, you have to check the common case insensitive words appearing in both sentences.

If there are duplicate words in the results, just choose one. The results should be sorted by words length.

The sentences are presented as list of words. Example:

S = ['You', 'can', 'do', 'anything', 'but', 'not', 'everything']
##                  **                       **
T = ['We', 'are', 'what', 'we', 'repeatedly', 'do', 'is', 'not', 'an', 'act']
##                                             **          **
Result = ['do', 'not']
Login and get coding
go back Intermediate level
Bitecoin 3X

175 out of 175 users completed this Bite.
Will you be Pythonista #176 to crack this Bite?
Resolution time: ~25 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 2.14 on a 1-10 difficulty scale.
» You can do it! 😌

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help